package com.ss.android.download.a;

import java.io.PrintWriter;
import java.io.Writer;

public final class b extends PrintWriter {
    public final String a;
    public StringBuilder b;
    public char[] c;
    private int d;
    private boolean e;

    public b(Writer arg2, String arg3) {
        this(arg2, arg3, (byte) 0);
    }

    private b(Writer arg2, String arg3, byte arg4) {
        super(arg2);
        this.b = new StringBuilder();
        this.e = true;
        this.a = arg3;
    }

    public final void a(String arg3, Object arg4) {
        this.print(arg3 + "=" + String.valueOf(arg4) + " ");
    }

    private void a() {
        if(this.e) {
            this.e = false;
            if(this.b.length() != 0) {
                if(this.c == null) {
                    this.c = this.b.toString().toCharArray();
                }

                super.write(this.c, 0, this.c.length);
            }
        }
    }

    public final void write(char[] arg6, int arg7, int arg8) {
        this.b.length();
        int v2 = arg7 + arg8;
        int v0 = arg7;
        while(arg7 < v2) {
            int v1 = arg7 + 1;
            int v3 = arg6[arg7];
            ++this.d;
            if(v3 == 10) {
                this.a();
                super.write(arg6, v0, v1 - v0);
                this.e = true;
                this.d = 0;
                v0 = v1;
            }

            arg7 = v1;
        }

        if(v0 != arg7) {
            this.a();
            super.write(arg6, v0, arg7 - v0);
        }
    }
}

